<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:util="http://xmlns.jcp.org/jsf/composite/util">

    <p:outputPanel layout="block" rendered="#{folderAdministrationBean.selectedFolder.stamp != null}">
        <p:outputLabel value="Stampila:"/>
        <h:outputText value="#{folderAdministrationBean.selectedFolder.stamp}"/>
    </p:outputPanel>
    <p:outputPanel layout="block" rendered="#{folderAdministrationBean.selectedFolder.cardID != null}">
        <p:outputLabel value="Legitimatie:"/>
        <h:outputText value="#{folderAdministrationBean.selectedFolder.cardID}"/>
    </p:outputPanel>

    <h:form id="salaries_form">
        <util:dataTableWrapper title="Lista salarii">
            <f:facet name="buttonContent">
                <p:commandButton icon="custom-icon-add" value="Adauga salariu"
                                 oncomplete="PF('add_salary_WV').show()" update=":create_salary_form"
                                 resetValues="true"
                                 actionListener="#{employmentDataBean.resetCreateSalaryDialog}"/>
            </f:facet>
            <p:dataTable var="s" value="#{employmentDataBean.salaries}"
                         emptyMessage="Nu a fost gasita nici o inregistrare.">

                <p:column headerText="Gradul de salarizare">
                    <h:outputText value="#{s.salaryLevel.name}"/>
                </p:column>

                <p:column headerText="Treapta de salarizare">
                    <h:outputText value="#{s.salaryStep.name}"/>
                </p:column>

                <p:column headerText="Salariul de functie">
                    <h:outputText value="#{s.amount}"/>
                </p:column>

                <p:column headerText="Data stabilirii">
                    <h:outputText value="#{s.establishmentDate}">
                        <f:convertDateTime pattern="dd/MM/yyyy"/>
                    </h:outputText>
                </p:column>

                <p:column styleClass="override-icons" headerText="Actions">
                    <p:commandButton icon="custom-icon-edit"
                                     actionListener="#{employmentDataBean.initEditSalaryDialog(s)}"
                                     oncomplete="PF('add_salary_WV').show()" update=":create_salary_form"/>

                    <p:commandButton icon="custom-icon-delete"
                                     actionListener="#{employmentDataBean.deleteSalary(s)}"
                                     update="@form">
                        <p:confirm header="Confirma"
                                   message="Sunteti sigur ca doriti stergerea salariului?"
                                   icon="ui-icon-alert"/>
                    </p:commandButton>

                </p:column>
            </p:dataTable>
        </util:dataTableWrapper>

        <p:confirmDialog global="true">
            <p:commandButton value="Da" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check"/>
            <p:commandButton value="Nu" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close"/>
        </p:confirmDialog>
    </h:form>
</ui:composition>